/*
 * dl.h
 *
 *  Created on: 24/giu/2014
 *      Author: Pasquale
 */

#ifndef DL_H_
#define DL_H_

#include "nRF24L01P.h"

#define MAX_DL_LENGTH 		1920
#define PAYLOAD_DL_LENGTH  		30

#define FRAGNUM_MASK			0x3f

/* Richiama la setup di livello inferiore
 */
void init_dl();

void resetBuffer(uint8_t* pbuff, uint16_t length);
void printBuffer(uint8_t* pbuff, uint16_t length);
void preparePayload(uint8_t*, uint8_t*, uint16_t, uint8_t);
void stripPayload(uint8_t* buffDest, uint8_t* buffSource, uint8_t offsetSource, uint8_t offsetDest, uint8_t buffSourceLength);
uint8_t TxPacket(uint8_t* pdata, uint16_t length);
uint8_t RxFrame(uint8_t* pdata, uint8_t length);
//RxPacket bloccante

uint8_t RxPacket(uint8_t* pdata);



#endif /* DL_H_ */
